﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace HotelMgr.Models
{
    public class Employee
    {
        public Guid EmployeeID { get; set; }

        /// <summary>
        /// 职员姓名
        /// </summary> 
        [DisplayName("职员姓名")]
        [StringLength(20)]
        public string Name { get; set; }

        ///<summary>
        /// 员工编号
        /// </summary>
        [DisplayName("员工编号")]
        [StringLength(20)]
        public string EmployeeNumber { get; set; }

        /// <summary>
        /// 身份证 
        /// </summary>
        [DisplayName("身份证")]
        [StringLength(20)]
        public string IDCard { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [DisplayName("性别")]
        [StringLength(20)]
        public string Sex { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        [DisplayName("电话")]
        [StringLength(20)]
        public string Phone { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [DisplayName("地址")]
        [StringLength(70)]
        public string Address { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        [DisplayName("生日")]
        public DateTime? Birthday { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        [DisplayName("年龄")]
        public int? Age
        {
            get
            {
                if (Birthday == null) return null;
                int yearSpan = DateTime.Now.Year - Birthday.Value.Year;
                int monthSpan = DateTime.Now.Month - Birthday.Value.Month;
                if (monthSpan <= 0) yearSpan++;
                return yearSpan;
            }
        }
        /// <summary>
        /// 雇佣时间
        /// </summary>
        [DisplayName("雇佣时间")]
        public DateTime? HireDate { get; set; }
        /// <summary>
        /// 离职时间
        /// </summary>
        [DisplayName("离职时间")]
        public DateTime? DismissalDate { get; set; }
    }
}